package com.piaohailin.feature.generic;

public class SearchT <T>{

    public SearchT() {
    }

    public int search(T[] a, T target){
        for(int i = 0; i<a.length ; i++){
            if (a[i] == target)
                return i;
        }

        return -1;
    }

    public static void main(String[] args){
//        Integer[] a = {1,3,5,6,7};
//        SearchT<Integer> search = new SearchT();
//        System.out.println(search.search(a,1));
        String[] a = {"1","3","5","6","7"};
        SearchT<String> search = new SearchT();
        System.out.println(search.search(a,"0"));
    }
}
